<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.7.14/dist/vue.js"></script>
</head>
<style>
    input{
        width: 50px;
    }
</style>
<body>
    <div id="app">
        姓：<input type="text" v-model="firstName"> 名：<input type="text" v-model="lastName"> =
        <span>{{fullName}}</span>
        <br><br>
        <button @click="fun()">改名卡</button>
    </div>
</body>
<script>
   const app=new Vue({
    el:'#app',
    data:{
        firstName:"",
        lastName:""
    },
    methods:{        
        fun(){
            this.fullName='黄忠'
        }
    }
    ,
    computed: {
        fullName:{
           get(){
            return this.firstName+this.lastName
           },
           set(s){
             this.firstName=s.slice(0,1);
             this.lastName=s.slice(1);
           }
        }
    }

   })
</script>
</html>